import 'package:flutter/material.dart';
import 'package:flutter_chat/common/style/theme.dart';
import 'package:flutter_chat/common/widget/cell/cell.dart';
import 'package:flutter_chat/common/widget/image/image.dart';
import 'package:get/get.dart';

import 'logic.dart';

class UserPage extends GetView<UserLogic> {
  const UserPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ListView(
      physics: const BouncingScrollPhysics(
        parent: AlwaysScrollableScrollPhysics(),
      ),
      children: [
        _buildUser(),
        const SizedBox(height: AppTheme.largeSpace),
        const CellWidget(
          right: Icon(Icons.chevron_right),
          title: "设置",
          icon: Icons.settings,
        ),
      ],
    );
  }

  Container _buildUser() {
    return Container(
      color: Colors.white,
      child: const ListTile(
        contentPadding: EdgeInsets.symmetric(
          vertical: 20,
          horizontal: 20,
        ),
        leading: ImageWidget(
          path: "http://q1.qlogo.cn/g?b=qq&nk=3355691290&s=640",
          size: 50,
          radius: AppTheme.radius,
        ),
        title: Text(
          "今天比昨天更爱你.",
          style: TextStyle(
            fontWeight: FontWeight.bold,
            fontSize: AppTheme.largeFont,
          ),
        ),
        subtitle: Text(
          "微信号：z2417596062",
          style: TextStyle(
            fontWeight: FontWeight.bold,
            fontSize: AppTheme.smallFont,
            color: AppTheme.infoColor,
          ),
        ),
        trailing: SizedBox(
          width: 60,
          child: Row(
            children: [
              Icon(Icons.qr_code),
              const SizedBox(width: AppTheme.largeSpace),
              Icon(Icons.chevron_right),
            ],
          ),
        ),
      ),
    );
  }
}
